package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

@Controller
public class PayController {

    @Resource
    private OrderFeignClient orderFeignClient;

    @GetMapping("pay.html")
    public String submitOrder(Long orderId, Model model){
        //根据订单id获取订单提交成功页面需要的金额&订单号
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",orderInfo);
        //点击提交跳转到pay页面，并传入orderId参数，所以service提交订单时返回result捎带orderId
        return "payment/pay";
    }

}
